package team3;

/** Represents goodness according to the concept of 'Mobility'.
 * <p>
 * Calculates goodness according the concept of 'mobility': Ensuring that your
 * enemy has the least number of moves possible. This concept of mobility comes
 * from <a href="http://en.wikipedia.org/wiki/Reversi">wikipedia</a>.
 * <p>
 * In general, we've found that Mobility is poor as a sole goodness function.
 */
public class MobilityGoodness implements GoodnessFunction
{
    /**Determines the mobility of a given board state, according to how many
     * moves your enemy can make.
     * @return Negative number of how many moves your enemy can make, 0==good, -9==bad
     */
    public double evaluateGoodness(BoardState state, AI.Player playerToMaximize)
    {
        AI.Player otherPlayer = (playerToMaximize==AI.Player.BLACK)
                ?AI.Player.WHITE : AI.Player.BLACK;
        //determine how many moves your enemy can make,
        //return the negative value of that
        return -state.getAvailableMoves(otherPlayer).size();
    }

    public String getName()
    {
        return "mobility";
    }
}